<!-- 首页 -->
<template>
	<view class="container padding">
		<view class="bg-white radius">
			<view class="text-center padding">
				<text v-show="awardsInfo.check_result == 0"
					class="text-orange text-xl text-bold">暂无成绩</text>
				<text v-show="awardsInfo.check_result == 1"
					class="text-orange text-xl text-bold">未得奖</text>
				<text v-show="awardsInfo.check_result == 3 || awardsInfo.check_result == 2"
					class="text-orange text-xl text-bold">{{awardsInfo.check_reward_level_name}}</text>
			</view>
			<view class="text-center" v-if="awardsInfo.check_result == 2 || awardsInfo.check_result == 1">
				<text class="text-gray">{{awardsInfo.check_result_desc || '很遗憾，未晋级'}}</text>
			</view>
			<view class="text-center padding-bottom-sm" v-if="awardsInfo.check_result == 3">
				<text class="text-green ">{{awardsInfo.check_result_desc || '恭喜，成功晋级'}}</text>
			</view>
			<view class="padding-sm padding-top-xs">
				<u-cell-group :border="false">
					<u-cell title="姓名" :value="awardsInfo.student_name"></u-cell>
					<u-cell title="证件号" :value="maskIdCard(awardsInfo.student_document_nums)"></u-cell>
					<!-- <u-cell title="参赛编号" :value="awardsInfo.id"></u-cell> -->
					<u-cell title="赛事名称" :value="awardsInfo.match_type_name"></u-cell>
					<u-cell title="参赛组别" :value="awardsInfo.match_parent_cate_name"></u-cell>
					<u-cell title="参赛组项" :value="awardsInfo.match_cate_name"></u-cell>
					<u-cell title="参赛区域" :value="awardsInfo.match_area_group_name"></u-cell>
					<u-cell title="得分" :value="awardsInfo.check_score || '-'"></u-cell>
					<u-cell title="晋级情况" :value="awardsInfo.check_remark || '-'"></u-cell>

				</u-cell-group>
			</view>

		</view>
		<view class="margin-top" v-if="awardsInfo.check_result == 3">
			<u-button type="primary" color="#39b54a" :plain="true" text="晋级报名"
				@click="toGameSignUP(awardsInfo.match_type_id)"></u-button>
		</view>
	</view>
</template>

<script>
	import SignUpInfo from "@/pages/components/SignUpInfo.vue"
	export default {
		name: "",
		components: {
			SignUpInfo
		},
		data() {
			return {
				awardsInfo: {},
				// 报名详情
				gameInfo: null
			}
		},
		onLoad(query) {
			this.awardsInfo = JSON.parse(decodeURIComponent(query.info))
		},
		methods: {
			// 跳转报名页面
			toGameSignUP(id) {
				this.navigateTo('/pages/pages_game/gameDetail?id=' + id)
			},
			maskIdCard(idCard) {
				if (idCard.length !== 18) {
					return "****";
				}
				return idCard.substring(0, 6) + "****" + idCard.substring(17);
			},
			// 获取详细报名信息
			getGameSignUpInfo(id) {
				this.$http.getGameSignUpInfo({
					id
				}).then(res => {
					let {
						student_document_img: document_img,
						student_name: name,
						student_sex: sex,
						student_nation: nation,
						student_national: national,
						match_type_name: type_name,
						all_group_name,
						act_song,
						act_duration,
						student_organ_name: organ_name,
						student_train_teacher_name: train_teacher_name,
						student_train_teacher_mobile: train_teacher_mobile,
						student_document_type: document_type,
						student_document_nums: document_nums,
						student_contact_name: contact_name,
						student_contact_mobile: contact_mobile,
						scene_code,
						student_contact_address: contact_address,
						amount
					} = res
					this.gameInfo = {
						document_img,
						name,
						sex,
						nation,
						national,
						type_name,
						all_group_name,
						act_song,
						act_duration,
						organ_name,
						train_teacher_name,
						train_teacher_mobile,
						document_type,
						document_nums,
						contact_name,
						contact_mobile,
						scene_code,
						amount,
						contact_address
					}
					console.log(res);
				})
			}
		}
	}
</script>

<style scoped lang="scss">
	.container {
		.c-module {
			background-color: #fff;
			border-radius: 8rpx;
			box-shadow: 0 0 10rpx 0 rgba(0, 0, 0, 0.1);
		}
	}
</style>